﻿package com.mod   {
	
    import com.calefk.util.SoundManager;
    import com.calefk.util.SoundMaster;
    import com.mod.data.Config;
	import com.mod.data.dtGame;
    import com.mod.data.Strings;
    import com.mod.engine.Engine;
   
	public class Global {
		
		public static var SW:int = 640;
        public static var SH:int = 480;
		
		public static var TILE_WIDTH :int = 32;
		public static var TILE_HEIGHT:int = 32;
		
		public static var currentLevel:int = 0;
		
		
		public static var project:ModProject;
		public static var engine:Engine;
		public static var score:int;
        
        // variables para facebook y bd
        public static var friends:Array;
        
        // arvhivos XML
        public static var config:Config = new Config();
        public static var strings:Strings = new Strings();
        public static var dataGame:dtGame = new dtGame();
        
        // variables y funciones para sonidos
        public static var soundMaster:SoundMaster;
        public static var isMute:Boolean;
        
        public static var webmode:Boolean = false;
		
		public static var	mapBits:Array = [
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
						 [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] 
						];
        
        public static function registerSounds():void {
            // se registra los sonidos para que no haya un lag cada vez que se reproduce uno nuveo
            soundMaster = new SoundMaster(project.lb_sounds);
            soundMaster.registerSound("snd_ganaste_trofeo");
			

        }
        
        public static function playSound(id:String , loop:int , volumen:Number = 1):void {
            if (!isMute) {
                SoundManager.playSound(id , loop , volumen , project.lb_sounds);
            }
        }
        
        public static function stopSound(id:String):void {
            SoundManager.stopSound(id);
        }
        
        public static function stopAllSounds():void {
            SoundManager.stopAllSounds();
        }
        
        public static function toggleSounds():void {
            isMute = !isMute;
            if (isMute) {
                SoundManager.stopAllSounds();
            }
        }
	}
}